/**
 * Copyright (c) 2016-2019 拓尔思 All rights reserved.
 *
 * https://www.trs.com
 *
 * 版权所有，侵权必究！
 */

package com.example.nft.config;


import java.util.HashMap;
import java.util.Map;

/**
 * 返回数据
 *
 * @author xyk
 */
public class Response extends HashMap<String, Object> {
	private static final long serialVersionUID = 1L;

	public Response() {
		put("code", 200);
		put("msg", "success");
	}

	
	public static Response error(int code, String msg) {
		Response r = new Response();
		r.put("code", code);
		r.put("msg", msg);
		return r;
	}

	public static Response ok(String msg) {
		Response r = new Response();
		r.put("msg", msg);
		return r;
	}
	
	public static Response ok(Map<String, Object> map) {
		Response r = new Response();
		r.putAll(map);
		return r;
	}

    public static Response ok() {
		return new Response();
    }


    public Response put(String key, Object value) {
		super.put(key, value);
		return this;
	}
}
